<?php defined('_JEXEC') or die('Restricted access'); ?>
<form action="index.php?option=com_articlecashrewards" method="post" name="adminForm">
<div id="submenu-box">
    <div class="t">
        <div class="t">
            <div class="t"></div>
        </div>
    </div>
    <div class="m">
        <ul id="submenu">
            <li>
                <a href="index.php?option=com_articlecashrewards&controller=referrals&task=pending"><?php echo JText::_('LABEL_PENDING');?></a>
            </li>
            <li>
                <a class="active" href="index.php?option=com_articlecashrewards&controller=referrals&task=reviewed"><?php echo JText::_('LABEL_REVIEWED');?></a>
            </li>
            <li>
                <a href="index.php?option=com_articlecashrewards&controller=referrals&task=recalcpage"><?php echo JText::_('LABEL_RUN_REFERRAL');?></a>
            </li>
            <li>
                <a href="index.php?option=com_articlecashrewards&controller=referrals&task=manageRules"><?php echo JText::_('LABEL_REFERRAL_RULES');?></a>
            </li>
        </ul>
        <div class="clr"></div>
    </div>
    <div class="b">
        <div class="b">
            <div class="b"></div>
        </div>
    </div>
</div>
<table class="adminlist" width="100%">
    <?php if($this->result){ ?>
    <tr>
        <td>
            <table class="adminlist" cellspacing="1" width="100%">
                <thead>
                    <tr>
                        <th width="5">
                            <?php echo JText::_( 'Num' ); ?>
                        </th>
                        <th width="10">
                            <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->result ); ?>);" />
                        </th>
                        <th>
                            <?php echo JText::_('LABEL_REFERRER'); ?>
                        </th>
                        <th width="30%">
                            <?php echo JText::_('TITLE_USER_NAME'); ?>
                        </th>
                        <th width="20%" class="title">
                            <?php echo JText::_('LEVEL_ELIGIBLE'); ?>
                        </th>
                        <th width="10%" class="title">
                            <?php echo JText::_('NO_OF_ARTICLES'); ?>
                        </th>
                        <th width="10%" class="title">
                            <?php echo JText::_('LABEL_AMOUNT'); ?>
                        </th>
                        <th width="10%" class="title">
                            <?php echo JText::_('LABEL_STATUS'); ?>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $k = 0;
                    $i = 0;
                    foreach($this->result as $row){
                        $checked 	= JHTML::_('grid.id', $i,  $row->id  );
                        ?>
                        <tr class="<?php echo "row$k"; ?>">
                            <td align="left">
                                <?php echo $this->pagination->getRowOffset( $i); ?>
                            </td>
                            <td align="left">
                                <?php echo $checked; ?>
                            </td>
                            <td align="left">
                                <?php echo $row->referredby; ?>
                            </td>
                            <td align="left">
                                <?php echo $row->referral; ?>
                            </td>
                            <td align="left">
                                <?php echo $row->ruleid . ' : ' . $row->rulename; ?>
                            </td>
                            <td align="left">
                                <?php echo $row->articles; ?>
                            </td>
                            <td align="left">
                                <?php echo $row->amount; ?>
                            </td>
                            <td align="left">
                                    <?php
                                        if($row->status == 1){
                                            $img = 'published.png';
                                            $alt = 'LABEL_APPROVED';
                                        }else if($row->status == 2){
                                            $img = 'rejected.png';
                                            $alt = 'LABEL_REJECTED';
                                        }else{
                                            $img = 'pending.png';
                                            $alt = 'LABEL_PENDING';
                                        }
                                    ?>
                                    <img src="components/com_articlecashrewards/assets/images/<?php echo $img; ?>"
                                        border="0" title="<?php echo JText::_( $alt ); ?>"
                                        alt="<?php echo JText::_( $alt ); ?>" />
                            </td>
                        </tr>
                        <?php
                        $k = 1 - $k;
                        $i++;
                    }
                    ?>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="8" nowrap="nowrap"><?php echo $this->pagination->getListFooter(); ?></td>
                    </tr>
                </tfoot>
            </table>
             </fieldset>
        </td>
    </tr>
    <?php
    } else{
        echo JText::_('MSG_NO_RESULTS');
    }
    ?>
</table>
<input type="hidden" name="option" value="com_articlecashrewards" />
<input type="hidden" name="controller" value="referrals" />
<input type="hidden" name="task" value="reviewed" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
